<template>
	
	<view class="wrap">
		
		<view class="uni-margin-wrap">
			<swiper class="swiper">
				<swiper-item v-for="(item,index) in items" :key="index">
					<view class="swiper-item uni-bg-red">
						<view class="img-wrap">
							<image :src="item.img" mode=""></image>
						</view>
						<view class="desc-wrap">
							<view class="name">{{item.name}}</view>
							<view class="price">
								<text>￥</text>
								<text class="big">
									{{item.price}}
								</text>
							</view>
						</view>
					</view>
				</swiper-item>
				
			</swiper>
		</view>
		
	</view>
</template>

<script>
	export default{
		data(){
			return{
				items:[{
					
				}],
				nowsel:{
					index:'no'
				}
			}
		},
		onShow() {
			
		},
		onLoad(){
			this.getData()
		},
		methods:{
			subData(){
				let that=this
				if(this.nowsel.index==='no'){
					uni.showToast({
					    title: '未选择代理类型',
					    dduration:4000,
						icon:'none'
					});
					return
				}
				uni.showModal({
				    title: '确认提交？',
				    content: '',
				    success: function (res) {
				        if (res.confirm) {
				            that.apipost('/api/user/submit_agent',{
								id:that.items[that.nowsel.index]
				            },true).then(res => {
				            	if(res.Code==10200){
									uni.showToast({
										title: res.Message,
										duration:4000,
										icon: 'none'
									});
									//uni.navigateBack()
				            		// let data=res.Data?res.Data:{}
				            		// that.dataObj=res.Data?res.Data:{}
				            		// that.src=that.dataObj.charge_address
				            	}
				            	
				            }).catch(err=>{
				            	console.log(err)
				            });
				        } else if (res.cancel) {
				            
				        }
				    }
				});
			},
			getData(){
				let that=this
				that.apipost('/api/user/agent').then(res => {
					if(res.Code==10200){
						that.items=res.Data
					}
					
				}).catch(err=>{
					console.log(err)
				});
			},
			tabType(type){
				this.nowsel.index=type
			}
		}
	}
</script>

<style>
	.desc-wrap .name{
		padding:40rpx 0 0 22rpx;
		font-size:42rpx;
		font-weight:bold;
	}
	.desc-wrap .price{
		font-weight:bold;
		padding:40rpx 0 0 22rpx;
		color:red;
	}
	.desc-wrap .big{
		color:red;
		font-size:49rpx;
		font-weight:bold;
	}
	.swiper .img-wrap{
		height:50%;
		width:80%;
		margin:0 auto;
		top:-30rpx;
	}
	.swiper .desc-wrap{
		position:absolute;
		z-index:34;
		top:48%;
		width:100%;
		height:30rpx;
		
	}
	.uni-margin-wrap{
		position:relative;
		z-index:1;
		width:90%;
		margin:0 auto;
		height:60vh;
		margin-top:20vh;
	}
	
	.swiper-item{
		position:relative;
		width:90%;
		margin:0 auto;
		height:100%;
		background:url(/static/dailicard.png) no-repeat center;
		background-size:100% 100%;
	}
	.swiper{
		position:relative;
		z-index:1;
		height:100%;
		width:100%;
	}
	.sub-btn{
		width:684rpx;
		border-radius:10rpx;
		margin:0 auto;
		margin-top:150rpx;
		color:#fff;
		background:#f9436b;
		height:100rpx;
		display:flex;
		align-items:center;
		justify-content:center;
	}
	.wrap{
		padding-top:60rpx;
	}
	.icon-wrap{
		
		width:88rpx;
		height:88rpx;
		margin-right:40rpx;
	}
	.list-item .left{
		display:flex;
	}
	.list-item .right{
		
		display:flex;
		align-items: center;
	}
	.list-item{
		padding:36rpx 40rpx 28rpx 46rpx;
		/* border:1rpx solid #b4b4b4; */
		box-sizing: border-box;
		border-radius: 10rpx;
		width:684rpx;
		margin:0 auto;
		justify-content: space-between;
		color:#000;
		display:flex;
		align-items: center;
		background: url(/static/changtiao.png) no-repeat center;
		background-size:100% 100%;
		margin-bottom:58rpx;
	}
	.active{
		background: url(/static/changtiaoa.png) no-repeat center!important;
		background-size:100% 100%!important;
	}
	page{
		background:url(/static/dailibg.jpg) no-repeat center;
		background-size:100% 100%;
	}
</style>